﻿
seajs.config({
    base: '../js/',
    alias: {
        'labjs': 'lib/LAB.min',
    }
});


define(function (require) {
    require('labjs');
    
        
    // 载入基础lib
    $LAB.script('../js/lib/jquery-1.6.1.min.js').wait()
        .script('../js/lib/jquery.mobile-1.0b2.js').wait()
        .script('../js/lib/underscore-min.js').wait()
        .script('../js/lib/backbone.min.js').wait(
            function () {
                $('#page').live('pagecreate',function(event){
                    var ContactContainerView = require('views/contactcontainer.view');

                    contactContainerView = new ContactContainerView(null);
                    
                    contactContainerView.bind('changeToGroup', function () {
                        $('.group-list').show();
                        $('.contact-list').hide();
                    });
                    contactContainerView.bind('changeToPerson', function () {
                        $('.group-list').hide();
                        $('.contact-list').show();
                    });

                    contactContainerView.renderPerson();
                    contactContainerView.renderGroup();
                    
                    $('#page').append(contactContainerView.el);
                });
                
                $('#page').page('destroy').page();
            }
        )
});
